var _editor = UE.getEditor('myEditorFile');
var attachmentOwner = "";
var showId = "";
_editor.setOpt({
	extension : "*.*",
	description : "附件选择，可多选",
	sizeLimit : "512000",
	dataType : "json"
});
// 弹出文件上传的对话框
function upFiles(current, showdiv) {
	attachmentOwner = current;
	showId = showdiv;
	var myFiles = _editor.getDialog("attachment");
	myFiles.open();
}
_editor.ready(function() {
	// 设置编辑器不可用
	_editor.setDisabled();
	// 隐藏编辑器，因为不会用到这个编辑器实例，所以要隐藏
	_editor.hide();
	// 侦听文件上传，取上传文件列表中第一个上传的文件的路径
	_editor.addListener('afterUpfile', function(t, arg) {
		if (arg != null && arg.length > 0) {
			var html = "";
			for (var i = 0, a = arg.length; i < a; i++) {
				if (arg[i].url != null) {
					html += "<input type='hidden' name='filePath' value='"+arg[i].url+"'/>" +
					"<input type='hidden' name='fileName' value='"+arg[i].original+"'/>" +
					"<input type='hidden' name='attachmentOwner' value='"+attachmentOwner+"'/>" +
					"<a class='views' href='" + arg[i].url
					+ "' target='_blank'>" + arg[i].original + "</a><br/>";
				}
			}
			if ($("#" + showId)) {
				$("#" + showId).append(html);
			}
		}
	});
});